﻿@model RXY_Mall.Application.Order.Dto.GetOrderOutput
<div class="content-wrapper" style="min-height: 1125.2px;">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            发货单
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
            <li><a href="#">订单列表</a></li>
            <li class="active">发货单</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="invoice" id="printPage">
        <!-- title row -->
        <div class="row">
            <div class="col-xs-12">
                <h2 class="page-header" style="text-align:center">
                    发货单
                </h2>
            </div>
            <!-- /.col -->
        </div>
        <!-- info row -->
        <div class="row">
            <div class="col-xs-6">
                <p class="text-muted">
                    订单编号:@Model.order_no
                </p>
            </div>
            <!-- /.col -->
            <div class="col-xs-6">
                <p class="text-muted">
                    下单时间:@Model.add_time
                </p>
            </div>
            <!-- /.col -->
        </div>
        <div class="row" style="margin-top: 10px;">
            <div class="col-xs-6">
                <p class="text-muted">
                    收货人:@Model.address.accepter_name
                </p>
            </div>
            <!-- /.col -->
            <div class="col-xs-6">
                <p class="text-muted">
                    手机号码:@Model.address.mobile
                </p>
            </div>
            <!-- /.col -->
        </div>
        <div class="row" style="margin-top: 5px;">
            <div class="col-xs-12">
                收货地址:@Model.address.area.Replace(",", "")@Model.address.address
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
        <!-- Table row -->
        <div class="row" style="margin-top: 10px;">
            <div class="col-xs-12 table-responsive">
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>商品编号</th>
                            <th>商品名称</th>
                            <th>规格</th>
                            <th>数量</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td width="15%">@Model.goods.goods_id</td>
                            <td width="40%">@Model.goods.goods_name</td>
                            <td width="30%">@Model.goods.json_specs</td>
                            <td width="15%">@Model.goods.goods_quantity</td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->

        <div class="row" style="margin-top: 10px;">
            <!-- accepted payments column -->
            <div class="col-xs-6">
                <p class="text-muted">
                    快递公司:_________________________________
                </p>
            </div>
            <!-- /.col -->
            <div class="col-xs-6">
                <p class="text-muted">
                    运单号:_________________________________
                </p>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
        <!-- this row will not appear when printing -->
        <div class="row no-print">
            <div class="col-xs-12" style="text-align:center">
                <a href="#" target="_blank" id="btPrint" onclick="printPage()" class="btn btn-default"><i class="fa fa-print"></i> 打印</a>
            </div>
        </div>
    </section>
    <!-- /.content -->
    <div class="clearfix"></div>
</div>

@section JS{
    <script>
        function remove_ie_header_and_footer() {
            let HKEY_Root, HKEY_Path, HKEY_Key;
            HKEY_Root = "HKEY_CURRENT_USER";
            HKEY_Path = "\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
            try {
                let RegWsh = new ActiveXObject("WScript.Shell");
                HKEY_Key = "header";
                RegWsh.RegWrite(HKEY_Root + HKEY_Path + HKEY_Key, "");
                HKEY_Key = "footer";
                RegWsh.RegWrite(HKEY_Root + HKEY_Path + HKEY_Key, "");
            }
            catch (e) { }
        }
        function printPage() {
            let printpage = document.getElementById("printPage");
            if (!!window.ActiveXObject || "ActiveXObject" in window) { //是否ie
                remove_ie_header_and_footer();
            }
            let newstr = printpage.innerHTML;
            let oldstr = document.body.innerHTML;
            document.body.innerHTML = newstr;
            window.print();
            document.body.innerHTML = oldstr;
            return false;
        }
    </script>
}